/**
 * 
 */
<template>
  <div id="qmviewer_container" style="height: 100%">
    <canvas id="mxcad"> </canvas>
  </div>
</template>

<script>
import qmviewer from "../../components/qmviewer";
import "../../css/lable.css";
import { QmodelOption } from '../../components/bimjs/QmodelServer.js'
import Mx from "mxdraw";
export default {
  name: "Demo2D",
  data() {
    return {
     
    };
  },
  // 注册组件
  components: {
    qmviewer,
  },
  /**
   * 数据发生改变
   */

  /**
   * 创建完毕
   */
  beforeCreate() {},
  created() {
    var netOption = new QmodelOption();
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var mm = window.location.href;
        mm = mm.substr(mm.lastIndexOf("?") + 1, 1024);
        var r = mm.match(reg); //匹配目标参数
        if (r != null) return unescape(decodeURI(r[2]));
        return null; //返回参数值
    }

    var file=getUrlParam('file');
    if(file)
      file=file.replaceAll('\\','/');
     // 动态加载 js库核心代码
     Mx.loadCoreCode().then(() => {
        // 创建控件对象
        Mx.MxFun.createMxObject({
          canvasId: "mxcad", // canvas元素的id

          cadFile: file?netOption.FILE_SERVE_URL+ file:"./static/dwg/$AS洋房.dwg",
        });
      });

  },
  computed: {
      
  },
    
  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
  
  },
};
</script>
<style scoped>
.moveBox {
  width: 500px;
  position: fixed;
  z-index: 99998;
  background: rgb(255, 255, 255);
  box-shadow: 0 0 5px 3px #95a5a6;
}
.moveBox .moveHead {
  height: 35px;
  background-color: rgb(51, 65, 87);
  cursor: move;
  color: #fff;
  padding: 9px 0 0 11px;
}
.moveBox .close {
  position: absolute;
  right: 0;
  top: 0;
  line-height: 30px;
  font-size: 24px;
  cursor: pointer;
  display: block;
  width: 30px;
  height: 30px;
  text-align: center;
  color: #fff;
}

.v-enter,
.v-leave-to {
  opacity: 0;
  transform: scale(0.5);
}
.content {
  padding: 10px;
}
.v-enter-active,
.v-leave-active {
  transition: all 0.5s ease;
}
</style>


 
 